home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / security / SecureRandomSpi.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  1.7 KB  |  58 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)SecureRandomSpi.java    1.2 98/03/26
  3.  *
  4.  * Copyright 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security;
  16.  
  17. /**
  18.  * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
  19.  * for the <code>SecureRandom</code> class.
  20.  * All the abstract methods in this class must be implemented by each
  21.  * service provider who wishes to supply the implementation
  22.  * of a cryptographically strong pseudo-random number generator.
  23.  *
  24.  * @version 1.2, 99/03/26
  25.  *
  26.  * @see SecureRandom
  27.  * @since JDK1.2
  28.  */
  29.  
  30. public abstract class SecureRandomSpi implements java.io.Serializable {
  31.  
  32.     /**
  33.      * Reseeds this random object. The given seed supplements, rather than
  34.      * replaces, the existing seed. Thus, repeated calls are guaranteed
  35.      * never to reduce randomness.
  36.      *
  37.      * @param seed the seed.
  38.      */
  39.     protected abstract void engineSetSeed(byte[] seed);
  40.  
  41.     /**
  42.      * Generates a user-specified number of random bytes.
  43.      * 
  44.      * @param bytes the array to be filled in with random bytes.
  45.      */
  46.     protected abstract void engineNextBytes(byte[] bytes);
  47.  
  48.     /**
  49.      * Returns the given number of seed bytes.  This call may be used to
  50.      * seed other random number generators.
  51.      *
  52.      * @param numBytes the number of seed bytes to generate.
  53.      * 
  54.      * @return the seed bytes.
  55.      */
  56.      protected abstract byte[] engineGenerateSeed(int numBytes);
  57. }
  58.